use std::sync::{Arc, RwLock};

#[derive(Clone, Debug)]
pub struct CmdCache {
    pub data: Arc<RwLock<Vec<String>>>,
}

impl CmdCache {
    pub fn new() -> Self {
        CmdCache {
            data: Arc::new(RwLock::new(Vec::new())),
        }
    }

    pub fn add_cmd(&self, cmd: String) {
        self.data.write().unwrap().push(cmd);
    }
}